<?php
    $xtpl_profile   = new XTemplate("view/member/profile.htm");
    
    $id = $_GET['id'];
    
    $sql    = "SELECT * FROM member WHERE id_m='" . $id . "'";
    $result = mysql_query($sql);
    $row    = mysql_fetch_array($result);
    
    if($row['birthday']==0){
        $birthday = "Không có";
    }
    else{
        $sqldate    = strtotime($row['birthday']);
        $birthday   = date('d-m-Y', $sqldate);
    }
    if($row['gender']==NULL){
        $gender = "Không xác định";
    }
    else{
        $gender = $row['gender'];
    }
    if($row['address']==NULL){
        $address = "Không có";
    }
    else{
        $address = $row['address'];
    }
    if($row['phone']==NULL){
        $phone = "Không có";
    }
    else{
        $phone = $row['phone'];
    }
    if($row['email']==NULL){
        $email = "Không có";
    }
    else{
        $email = $row['email'];
    }
    
    $xtpl_profile   -> assign('username', $row['username']);
    $xtpl_profile   -> assign('fullname', $row['fullname']);
    $xtpl_profile   -> assign('birthday', $birthday);
    $xtpl_profile   -> assign('gender', $gender);
    $xtpl_profile   -> assign('address', $address);
    $xtpl_profile   -> assign('phone', $phone);
    $xtpl_profile   -> assign('email', $email);
    $xtpl_profile   -> assign('id', $row['id_m']);
    
    $xtpl_profile   -> parse("PROFILE");
    $mid            = $xtpl_profile -> text("PROFILE");
?>